package blackitheima1.FileOutPut;

import java.io.*;

//字节缓冲流复制文件
public class MyFileOut1 {
    public static void main(String[] args) throws IOException {
        //创建字节缓冲输入流
        BufferedInputStream bfi=new BufferedInputStream(
                new FileInputStream("day12\\aaa"));
        //创建字节缓冲输出流
        BufferedOutputStream bfo=new BufferedOutputStream(
                new FileOutputStream("day12\\bbb"));
        //遍历复制文件
        /*int ch;
        while((ch=bfi.read())!=-1){
            bfo.write(ch);
        }*/

        byte[]bytes=new byte[1204];
        int len;
        while((len=bfi.read(bytes))!=-1){
            bfo.write(bytes,0,len);
        }
        //分别释放资源
        bfi.close();
        bfo.close();

    }
}
